import request from '@/config/axios'

// Amis模板页面 VO
export interface AmisPageVO {
  // 页面编码
  code: string
  // 版本号
  version: number
  // 页面描述
  remark: string
}

// Amis模板页面 API
export const AmisPageApi = {
  // 查询Amis模板页面分页
  getAmisPagePage: async (params: any) => {
    return await request.get({ url: `/dgs/amis-page/page`, params })
  },

  // 查询Amis模板页面详情
  getAmisPage: async (id: number) => {
    return await request.get({ url: `/dgs/amis-page/get?id=` + id })
  },

  // 新增Amis模板页面
  createAmisPage: async (data: AmisPageVO) => {
    return await request.post({ url: `/dgs/amis-page/create`, data })
  },

  // 修改Amis模板页面
  updateAmisPage: async (data: AmisPageVO) => {
    return await request.put({ url: `/dgs/amis-page/update`, data })
  },

  updateAmisJson: async (id: number, amisJson: string) => {
    const data = {
      id,
      amisJson
    }
    return await request.put({ url: `/dgs/amis-page/updateAmisJson`, data })
  },

  // 删除Amis模板页面
  deleteAmisPage: async (id: number) => {
    return await request.delete({ url: `/dgs/amis-page/delete?id=` + id })
  },

  // 导出Amis模板页面 Excel
  exportAmisPage: async (params) => {
    return await request.download({ url: `/dgs/amis-page/export-excel`, params })
  },
}
